﻿<UserControl x:Class="AdamDriscoll.Perspectives.PerspectivesControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:vsfx="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.10.0"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             Name="MyToolWindow"
             Background="{DynamicResource {x:Static vsfx:VsBrushes.ToolWindowBackgroundKey}}">

    <UserControl.Resources>
        <Style x:Key="ButtonStyle" TargetType="Button">
            <EventSetter Event="Button.Click" Handler="Refresh_Click"></EventSetter>
        </Style>
        <Style x:Key="myHeaderStyle" TargetType="{x:Type GridViewColumnHeader}">
            <Setter Property="Visibility" Value="Collapsed" />
        </Style>
    </UserControl.Resources>

    <Grid >
        

        <ListView Name="lstPerspectives"  Grid.Row="0">
            <ListView.Style>
                <Style TargetType="ListView">
                    <Style.Triggers>
                        <Trigger Property="HasItems"
                         Value="False">
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="ListView">
                                        <StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center"> 
                                            <TextBlock HorizontalAlignment="Center">Click to refresh the Perspectives Manager.</TextBlock>
                                            <Button HorizontalAlignment="Center" Style="{DynamicResource ButtonStyle}" Margin="5" Background="Transparent" BorderBrush="Transparent"> 
                                                <Image Width="48" Height="48" Source="pack://application:,,,/Perspectives;component/Actions-view-refresh.ico"/>
                                            </Button>
                                        </StackPanel>
                                        
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </ListView.Style>
            <ListView.View>
                <GridView  ColumnHeaderContainerStyle="{StaticResource myHeaderStyle}">
                    <GridViewColumn Width="40">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <Image Width="16" Height="16" Source="{Binding IconUri}"/>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                    <GridViewColumn>
                        <TextBlock Text="{Binding Name}" />
                    </GridViewColumn>
                    <GridViewColumn Width="40">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <Button ToolTip="Apply" Click="Apply_Click" Background="Transparent" BorderBrush="Transparent" BorderThickness="0" >
                                    <Image Width="16" Height="16" Source="pack://application:,,,/Perspectives;component/Button-Check.ico"/>
                                </Button>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                    <GridViewColumn Width="40">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <Button ToolTip="Save" Click="Save_Click"  Background="Transparent" BorderBrush="Transparent" BorderThickness="0">
                                    <Image Width="16" Height="16" Source="pack://application:,,,/Perspectives;component/Drive-Green.ico"/>
                                </Button>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                    <GridViewColumn Width="40">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <Button ToolTip="Delete" Click="Delete_Click"  Background="Transparent" BorderBrush="Transparent" BorderThickness="0">
                                    <Image Width="16" Height="16" Source="pack://application:,,,/Perspectives;component/Button-Remove.ico"/>
                                </Button>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                </GridView>
            </ListView.View>
        </ListView>
    </Grid>
</UserControl>
